#include<bits/stdc++.h>
#define int long long
#define N 1000006
#define mod 1000000007
using namespace std;

int n, k, ans;
int a[N];

int Pow(int a, int n) {
    if(n == 0) return 1;
    if(n == 1) return a;
    int x = Pow(a, n / 2);
    if(n % 2 == 0) return x * x % mod;
    else return x * x % mod * a % mod;
}
int inv(int x) {
    return Pow(x, mod - 2);
}
int fac[N], Inv[N];
void init() {
    int n = 1000000;
    fac[0] = Inv[0] = 1;
    for(int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % mod;
    Inv[n] = inv(fac[n]);
    for(int i = n - 1; i >= 1; i--) Inv[i] = Inv[i + 1] * (i + 1) % mod;
}
int C(int n, int m) {
    if(n < 0 || m < 0 || n < m) return 0;
    return fac[n] * Inv[m] % mod * Inv[n - m] % mod;
}
int P(int n, int m) {
    if(n < 0 || m < 0 || n < m) return 0;
    return fac[n] * Inv[n - m] % mod;
}
void upd(int &x, int y) {
    x = (x + y) % mod;
}

int f[N][2], g[N];

signed main() {
    freopen("game.in", "r", stdin);
    freopen("game.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    init();
    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> a[i];
    
    f[0][0] = 1;
    f[1][0] = 0;
    f[1][1] = 1;
    /*for(int i = 1; i <= n; i++) 
    for(int j = 0; j <= 1; j++) {
        for(int k = 1; k <= i; k++) { //Max填在k这个位置
            upd(f[i][j], f[k - 1][j ^ 1] * P(i - 1, i - k) % mod);
        }
        printf("f[%lld][%lld] = %lld\n", i, j, f[i][j]);
    }*/
    int r = inv(2);
    for(int i = 2; i <= n; i++) {
        f[i][0] = fac[i] * r % mod;
        f[i][1] = f[i][0];
    }
    for(int L = 1; L <= n; L++) {
        int res = C(k, L - 1) * P(n - 1 - L, k - L + 1) % mod * (f[L - 1][0] - f[L - 1][1] + mod) % mod;
        g[L] = (g[L - 1] + res) % mod;
    }

    for(int i = 1; i <= n; i++) {
        int res = g[i - 1] * a[i] % mod;
        ans = (ans + res) % mod;
        int L = i;
        int num = n - L;
        res = C(k, L - 1) * P(num, k - L + 1) % mod;
        ans = (ans - res * a[i] % mod * f[L - 1][1] % mod + mod) % mod;
        ans = (ans + res * a[i] % mod * f[L - 1][0] % mod) % mod;
    }
    /*for(int i = 1; i <= n; i++) {
        for(int L = 1; L <= i; L++) {
            int num = n - 1 - L;
            if(L == i) num++;
            int res = C(k, L - 1) * P(num, k - L + 1) % mod;
            ans = (ans - res * a[i] % mod * f[L - 1][1] % mod + mod) % mod;
            ans = (ans + res * a[i] % mod * f[L - 1][0] % mod) % mod;
        }
    }*/
    cout << ans * inv(P(n - 1, k)) % mod;
    return 0;
}